﻿package plugin.chatflash
{
    import cmd.*;
    import com.core.*;

    public class ChatFlashController extends Control
    {

        public function ChatFlashController(param1:Object)
        {
            super(param1);
            return;
        }// end function

        override public function update(param1:Obproxy, param2:ProxyChange) : void
        {
            if (param1.getName() == "chat")
            {
                switch(param2.property)
                {
                    case "additem":
                    {
                        this.target.showItem(param2.newvalue);
                        break;
                    }
                    case "addName":
                    {
                        this.target.addName(param2.newvalue);
                        break;
                    }
                    case "selectChannel":
                    {
                        this.target.selectChannel(param2.newvalue);
                        break;
                    }
                    case "pritalk":
                    {
                        this.target.privateChat(param2.newvalue);
                        break;
                    }
                    case "sendmypos":
                    {
                        this.target.mChannelControl.sendMyPosMsg(param2.newvalue);
                        break;
                    }
                    case "sendstallage":
                    {
                        this.target.mChannelControl.sendStallageMsg(param2.newvalue);
                        break;
                    }
                    case "addsysmsg":
                    {
                        this.target.mChannelControl.receiveSysMsg(param2.newvalue);
                        break;
                    }
                    case "normalmsg":
                    {
                        if (param2.newvalue.cmd == ChatCMD.ChannelSystem)
                        {
                            this.target.mChannelControl.receiveSysMsg(param2.newvalue.msg);
                        }
                        else if (param2.newvalue.cmd == ChatCMD.ChannelStage)
                        {
                            this.target.mChannelControl.receiveString(param2.newvalue.msg, param2.newvalue.cmd, param2.newvalue.serverid);
                        }
                        else
                        {
                            this.target.mChannelControl.receiveString(param2.newvalue.msg, param2.newvalue.cmd);
                        }
                        break;
                    }
                    case "posAnnounce":
                    {
                        this.target.mChannelControl.receivePosAnnounce(param2.newvalue);
                        break;
                    }
                    case "WdAnnounce":
                    {
                        this.target.mChannelControl.receiveWDAnnounce(param2.newvalue);
                        break;
                    }
                    default:
                    {
                        break;
                    }
                }
            }
            return;
        }// end function

    }
}
